class MyThread extends Thread {
    @Override
    public void run() {
        System.out.println("hello Thread");
    }
}

class MyRunnable implements Runnable {
    @Override
    public void run() {
        System.out.println("hello runnable");
    }
}

public class Main {
    public static void main1(String[] args) {
        Thread t1 = new Thread() {
            @Override
            public void run() {
                System.out.println("hello Thread");;
            }
        };

        Runnable r = new Runnable() {
            @Override
            public void run() {
                System.out.println("hello runnable");
            }
        };

        Thread t2 = new Thread(r);

        Thread t3 = new Thread(() -> {
            System.out.println("hello Thread t3");
        });
    }

    public static void main(String[] args) {
        Thread t = new Thread(() -> {
            while(true) {
                System.out.println("hello Thread");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        });

        t.setDaemon(true);
        t.start();

        while(true) {
            System.out.println("hello Main");
            try {
                Thread.sleep(1000);
                break;
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}